package com.cnbbx.cnbbx_web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 配置Swagger需要的配置类
 *
 * @author 金哥
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket ProductApi() {
        return new Docket(DocumentationType.SWAGGER_2).useDefaultResponseMessages(false).forCodeGeneration(false).pathMapping("/").select().paths(PathSelectors.any()).build().apiInfo(apiInfo());
    }

    public ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("测试系统").description("测试系统接口文档").version("v1.0").termsOfServiceUrl("https://www.cnbbx.com").contact(new Contact("金哥", "https://www.cnbbx.com", "admin@cnbbx.com")).build();
    }
}